|
OpenStack Icehouse : Use Virtual Storage(Multi-Backends)
2014/06/26 |
|
It's possible to use the Virtual Storage provided by Cinder
if an Instance needs more disks.
Configure Virtual storage with NFS and GlusterFS multi-backend on here.
+------------------+ +------------------+
10.0.0.35| [ Storage Node ] | 10.0.0.61| |
+------------------+ +-----+ Cinder-Volume | +-----+ GlusterFS #1 |
| [ Control Node ] | | eth0| | | eth0| |
| Keystone |10.0.0.30 | +------------------+ | +------------------+
| Glance |------------+------------------------------+
| Nova API |eth0 | +------------------+ | +------------------+
| Cinder API | | eth0| [ Compute Node ] | | eth0| |
+------------------+ +-----+ Nova Compute | +-----+ GlusterFS #2 |
10.0.0.51| | 10.0.0.62| |
+------------------+ | +------------------+
|
| +------------------+
| eth0| |
+-----+ NFS |
10.0.0.40| |
+------------------+
|
| [1] |
NFS server is required to be running on your LAN.
On this example, configure "/storage" directory on "nfs.srv.world" as a shared directory. |
| [2] |
GlusterFS server is required to be running on your LAN.
This example uses a replication volume "vol_distributed" provided by "gfs01" and "gfs02".
|
| [3] | Configure Storage Node. |
|
# install from EPEL
[root@storage ~]#
yum --enablerepo=epel -y install nfs-utils glusterfs glusterfs-fuse
[root@storage ~]#
vi /etc/cinder/cinder.conf # add follows in the [DEFAULT] section enabled_backends=nfs,glusterfs
[nfs]
volume_driver=cinder.volume.drivers.nfs.NfsDriver volume_backend_name=NFS nfs_shares_config=/etc/cinder/nfs_shares nfs_mount_point_base=/var/lib/cinder/nfs
[glusterfs]
volume_driver=cinder.volume.drivers.glusterfs.GlusterfsDriver volume_backend_name=GlusterFS glusterfs_shares_config=/etc/cinder/glusterfs_shares glusterfs_mount_point_base=/var/lib/cinder/glusterfs
[root@storage ~]#
vi /etc/cinder/nfs_shares # create new : specify NFS shared directories nfs.srv.world:/storage
[root@storage ~]#
vi /etc/cinder/glusterfs_shares # create new : specify GlusterFS volumes gfs01.srv.world:/vol_distributed
[root@storage ~]#
[root@storage ~]# chmod 640 /etc/cinder/nfs_shares [root@storage ~]# chgrp cinder /etc/cinder/nfs_shares [root@storage ~]# mkdir /var/lib/cinder/nfs [root@storage ~]# chown cinder. /var/lib/cinder/nfs [root@storage ~]# chmod 640 /etc/cinder/glusterfs_shares [root@storage ~]# chgrp cinder /etc/cinder/glusterfs_shares [root@storage ~]# mkdir /var/lib/cinder/glusterfs [root@storage ~]# chown cinder. /var/lib/cinder/glusterfs /etc/rc.d/init.d/openstack-cinder-volume restart Stopping openstack-cinder-volume: [ OK ] Starting openstack-cinder-volume: [ OK ] |
| [4] | Configure Compute Node to mount NFS and GlusterFS volumes. |
|
# install from EPEL
[root@node01 ~]#
yum --enablerepo=epel -y install nfs-utils glusterfs glusterfs-fuse
[root@node01 ~]#
vi /etc/nova/nova.conf # add follows in the [DEFAULT] section volume_drivers="nfs=nova.virt.libvirt.volume.LibvirtNFSVolumeDriver, glusterfs=nova.virt.libvirt.volume.LibvirtGlusterfsVolumeDriver" /etc/rc.d/init.d/openstack-nova-compute restart Stopping openstack-nova-compute: [ OK ] Starting openstack-nova-compute: [ OK ] |
| [5] | Create volume types. |
|
[root@dlp ~(keystone)]# cinder type-create nfs +--------------------------------------+------+ | ID | Name | +--------------------------------------+------+ | 37852f73-6d66-46c8-b6d4-654f30c0e75a | nfs | +--------------------------------------+------+[root@dlp ~(keystone)]# cinder type-create glusterfs +--------------------------------------+-----------+ | ID | Name | +--------------------------------------+-----------+ | bc729593-ff3e-4f01-a21a-64d46aa5d737 | glusterfs | +--------------------------------------+-----------+[root@dlp ~(keystone)]# cinder type-list +--------------------------------------+-----------+ | ID | Name | +--------------------------------------+-----------+ | 37852f73-6d66-46c8-b6d4-654f30c0e75a | nfs | | bc729593-ff3e-4f01-a21a-64d46aa5d737 | glusterfs | +--------------------------------------+-----------+ |
| [6] | Associates volume types set in [5] and names set in cinder.conf. |
|
[root@dlp ~(keystone)]# cinder type-key nfs set volume_backend_name=NFS [root@dlp ~(keystone)]# cinder type-key glusterfs set volume_backend_name=GlusterFS [root@dlp ~(keystone)]# cinder extra-specs-list
+--------------------------------------+-----------+----------------------------------------+
| ID | Name | extra_specs |
+--------------------------------------+-----------+----------------------------------------+
| 37852f73-6d66-46c8-b6d4-654f30c0e75a | nfs | {u'volume_backend_name': u'NFS'} |
| bc729593-ff3e-4f01-a21a-64d46aa5d737 | glusterfs | {u'volume_backend_name': u'GlusterFS'} |
+--------------------------------------+-----------+----------------------------------------+
|
| [7] | Create volumes with specifying volume types. |
|
[root@dlp ~(keystone)]# cinder create --display_name disk_nfs --volume-type nfs 10
+---------------------+--------------------------------------+
| Property | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| created_at | 2014-06-27T05:46:50.395655 |
| display_description | None |
| display_name | disk_nfs |
| encrypted | False |
| id | 04c8a41f-8ba3-44a8-a9e5-ad78a868f202 |
| metadata | {} |
| size | 10 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| volume_type | nfs |
+---------------------+--------------------------------------+
[root@dlp ~(keystone)]# cinder create --display_name disk_glusterfs --volume-type glusterfs 10
+---------------------+--------------------------------------+
| Property | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| created_at | 2014-06-27T05:47:09.165059 |
| display_description | None |
| display_name | disk_glusterfs |
| encrypted | False |
| id | 60687e44-953e-4eeb-b05e-c843ca5293e9 |
| metadata | {} |
| size | 10 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| volume_type | glusterfs |
+---------------------+--------------------------------------+
[root@dlp ~(keystone)]# cinder list +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ | ID | Status | Display Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ | 04c8a41f-8ba3-44a8-a9e5-ad78a868f202 | available | disk_nfs | 10 | nfs | false | | | 60687e44-953e-4eeb-b05e-c843ca5293e9 | available | disk_glusterfs | 10 | glusterfs | false | | +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ |
| [8] | The Configuration is all OK. Attach volumes to instances like follows. |
|
[root@dlp ~(keystone)]# nova list +--------------------------------------+-----------+---------+------------+-------------+--------------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-----------+---------+------------+-------------+--------------------------+ | 90304be0-c9e7-4632-b39f-ac734a8bfb1e | CentOS_65 | SHUTOFF | - | Shutdown | sharednet1=192.168.100.2 | +--------------------------------------+-----------+---------+------------+-------------+--------------------------+[root@dlp ~(keystone)]# nova volume-attach CentOS_65 04c8a41f-8ba3-44a8-a9e5-ad78a868f202 auto +----------+--------------------------------------+ | Property | Value | +----------+--------------------------------------+ | device | /dev/vdb | | id | 04c8a41f-8ba3-44a8-a9e5-ad78a868f202 | | serverId | 90304be0-c9e7-4632-b39f-ac734a8bfb1e | | volumeId | 04c8a41f-8ba3-44a8-a9e5-ad78a868f202 | +----------+--------------------------------------+[root@dlp ~(keystone)]# nova volume-attach CentOS_65 60687e44-953e-4eeb-b05e-c843ca5293e9 auto +----------+--------------------------------------+ | Property | Value | +----------+--------------------------------------+ | device | /dev/vdc | | id | 60687e44-953e-4eeb-b05e-c843ca5293e9 | | serverId | 90304be0-c9e7-4632-b39f-ac734a8bfb1e | | volumeId | 60687e44-953e-4eeb-b05e-c843ca5293e9 | +----------+--------------------------------------+ |